package com.study.springBoot;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.TextMessage;

@Component
public class SptingBootConsume {

    @Autowired
    Queue queue;

    @Autowired
    JmsMessagingTemplate jmsMessagingTemplate;



    public void consumeMessage() throws JMSException {
        TextMessage  message = (TextMessage) jmsMessagingTemplate.receive(queue);

        String text = message.getText();

        System.out.println(text);
    }
}
